<?php

require_once './core/p_pre.php';
process($db, $userId, $deviceId);
require_once './core/p_post.php';

function process(&$db, $userId, $deviceId) {
	require_once './core/dataset.php';
	$datasetId = trim(param('datasetId'));

	if ( strlen($datasetId) < 1) {
		return;
	}
	
	$fileName = param("f");
	if ( strlen($fileName) < 1 ) {
		$fileName = 'json';
	}
	
	$data = DataSet::findById($db, $datasetId);
	if ( $data == null || strlen($data->dataDir) < 1) {
		return;
	}
	require_once '../Data_Release/'.$data->dataDir.'/'.$fileName.'.txt';
}
